<?php defined('_JEXEC') or die('Restricted access'); ?>

<form action="index.php" method="post" name="adminForm">
<div id="editcell">
    <table class="adminlist">
    <thead>
        <tr>
            <th width="5">
                <?php echo JText::_( 'ID' ); ?>
            </th>
            <th width="20">   <!-- checkbox to check all items -->
                <input type="checkbox" name="toggle" value="" onclick="checkAll( <?php echo count($this->items); ?> );" /> 
            </th>
            <th>
                <?php echo JText::_( 'Event Date' ); ?>
            </th>
            <th>
                <?php echo JText::_( 'Event Time' ); ?>
            </th>
			<th>
                <?php echo JText::_( 'Title' ); ?>
            </th>
			<th>
                <?php echo JText::_( 'Category' ); ?>
            </th>
			<th>
                <?php echo JText::_( 'Published' ); ?>
            </th>
			<th>
                <?php echo JText::_( 'Ordering' ); ?>
            </th>
        </tr>            
    </thead>

    <?php
    $k = 0;
		//var_dump($this->items);
    for ($i=0, $n=count( $this->items ); $i < $n; $i++)
    {
        $row =& $this->items[$i];
		//var_dump('row '. $row);
        $checked = JHTML::_('grid.id', $i, $row->id );     //get checkbox HTML
		$published 		= JHTML::_('grid.published', $row, $i );
        // get link HTML to edit task for this greeting
        $link = JRoute::_( 'index.php?option=com_calendar&task=edit&cid='. $row->id );
    ?>
        <tr class="<?php echo "row".$k; ?>">
            <td>
                <?php echo $row->id; ?>
            </td>
            <td>
                 <?php echo $checked; ?> 
            </td>
            <td>
                <a href="<?php echo $link; ?>"><?php 
				//var_dump($row);
				$row->reg = new JRegistry('com_calendar');
				$row->reg->loadini($row->params);
				$date = $row->reg->getValue('com_calendar.start_date');
						echo $date;						
												?></a>
            </td>
            <td>
                <a href="<?php echo $link; ?>"><?php echo $row->start_time; ?></a>
            </td>
			<td>
                <a href="<?php echo $link; ?>"><?php echo $row->title; ?></a>
            </td>
			<td>
                <a href="<?php echo $link; ?>"><?php echo $row->cat_name; ?></a>
            </td>
			<td>
                <a href="<?php echo $link; ?>"><?php echo $published; ?></a>
            </td>
			<td>
                <a href="<?php echo $link; ?>"><?php echo $row->ordering; ?></a>
            </td>
        </tr>
    <?php
        $k = 1 - $k;    //switch row class
    }
    ?>
    
    </table>
</div>
<input type="hidden" name="option" value="com_calendar" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />

</form>